<div ng-controller="ClusterDiskMgmtCtrl">
    <div class="row-fluid">
        <div class="span9">
            <div class="btn-toolbar server-btn-toolbar ui-toolbar">
                <div class="btn-group">
                    <button type="button" class="btn btn-mini" ng-click="do_add()">新建</button>
                    <button type="button" class="btn btn-mini" ng-click="update_disk()" ng-disabled="!selected_disk||selected_disk.storage.protocol=='iscsi'">修改</button>
                </div>
                <div class="btn-group">
                    <button type="button" class="btn btn-mini" ng-click="attach_disk()" ng-disabled="!selected_disk||selected_disk.instance||selected_disk.instance.status=='running'">关联</button>
                    <button type="button" class="btn btn-mini" ng-click="detach_disk()" ng-disabled="!selected_disk||!selected_disk.instance||selected_disk.instance.status=='running'">解除</button>
                </div>

                <button type="button" class="btn btn-danger btn-mini" ng-click="delete_disk()" ng-disabled="!selected_disk">删除</button>
            </div>
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">×</button>
                对虚拟磁盘的修改需要虚拟机(hypervisor)重启后才会生效.关联和解除操作只能在虚拟机关闭状态下执行.
            </div>
        </div>
        <div class="span3">
            <span>每页显示</span>
            <select class="input-mini" ng-model="page_size" ng-options="pz for pz in page_sizes"
                    ng-change="change(page_size)"></select>
            <span>条</span>
        </div>
    </div>
    <table class="table table-bordered table-condensed">
        <thead>
        <tr>
            <th>名称</th>
            <th>类型</th>
            <th>存储</th>
            <th>大小(GB)</th>
            <th>磁盘总线</th>
            <th>创建日期</th>
            <th>关联实例</th>

        </tr>
        </thead>
        <tbody>
        <tr selectable exclusive ng-repeat="vdisk in vdisks|activeitem" ng-click="selectdisk()">
            <td>

                {{ vdisk.name }}
            </td>
            <td>{{ vdisk.format }}</td>
            <td>{{ vdisk.storage.name }}<span ng-show="vdisk.iscsilun" style="color:#0000ff">&nbsp;({{ vdisk.iscsilun.lun }})</span></td>
            <td>{{ vdisk.size }}</td>
            <td>{{ vdisk.bus||'ide' }}</td>
            <td>{{ vdisk.created_at |date:'yyyy-MM-dd HH:mm:ss Z' }}</td>
            <td>
                <a href="#/vm/{{ vdisk.instance.id }}" ng-show="vdisk.instance">
                    <img ng-src="/static/images/vmstatus/{{ vdisk.instance.status }}.png" alt="" class="img-size16"/>
                    {{ vdisk.instance.name }}
                </a>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="pagination">
        <ul>
            <li ng-hide="should_hide()" ng-class="prev_class" ng-click="prev()"><a href="javascript:void(0);">上一页</a>
            </li>
            <li ng-repeat="i in [] | range:page_count()" ng-hide="should_hide()" ng-click="page(i)"
                ng-class="(i == current_page) && 'active'">
                <a href="javascript:void(0)">{{ i + 1}}</a>
            </li>
            <li ng-hide="should_hide()" ng-class="next_class" ng-click="next()"><a href="javascript:void(0);">下一页</a>
            </li>
        </ul>
    </div>


</div>